import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  // 这里也可以不写(直接在路由拦截中查看是否有token, 决定去到登录页面, 还是自己有的页面)
  {
    path: '/',
    // 跳转到首页 /home
    // 路由拦截中判断有没有token(store)
    //  > next
    //  > next("/login")
    redirect: '/main',
  },
  {
    name: 'login',
    path: '/login',
    component: () => import('../views/login/login.vue'),
    meta: {},
  },
  {
    name: 'main',
    path: '/main',
    // redirect: "/main/analysis/overview",
    component: () => import('@/views/main/main.vue'),
    children: [
      // analysis
      //   {
      //     path: "analysis/overview",
      //     name: "overview",
      //     component: () => import("@/views/main/analysis/overview/overview.vue"),
      //   },
    ],
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router
